﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SLBehaviourSystem
{
    public class ArgumentContainer<T> where T:IEquatable<T>
    {
        public T Argument
        {
            get
            {
                return argument;
            }

            set
            {
                if (!argument.Equals(value))
                {
                    argument = value;
                    this.node.CheckInterrupt();
                }
            }
        }

        private T argument;

        private IConditionNode node;

        public ArgumentContainer()
        {
            argument = default(T);
        }

        public void BindNode(IConditionNode node)
        {
            this.node = node;
        }

        public void SetValueWithoutEvent(T value)
        {
            argument = value;
        }
    }
}
